<template>
<div class="">
    <div class="pr10">
        <div class="analyItem">
            <p class="analyItemTit tx-center">状态</p>
            <div class="analyItemCon">
                <span class="circlemark circlemark-lightRed">差</span>
            </div>
        </div>
    </div>
    <div class="thinScroll pr10" v-scrollHeight="84">
        <router-link tag="div" :to="routerPath('resultCompletion')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">完工</p>
            <div class="analyItemCon">
                <p class="col-md-4" >
                    <span class="pr8 cLightGray">完工率</span>
                    <span>{{(completmet.thisMonthCompletedRate * 100).toFixed(2)}}%</span>
                </p>
                <p class="col-md-4" >
                    <span class="pr8 cLightGray">标准</span>
                    <span>75%</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">差额</span>
                    <span class="">{{(75 - completmet.thisMonthCompletedRate * 100 ).toFixed(2)}}%</span>
                </p>
                <span v-if="completmet.thisMonthCompletedRate  >= 75" class="circlemark circlemark-green">优</span>
                <span v-else-if="completmet.thisMonthCompletedRate  < 75 &&  completmet.thisMonthCompletedRate  >= 70" class="circlemark circlemark-lightGreen">良</span>
                <span v-else-if="completmet.thisMonthCompletedRate  < 70 &&  completmet.thisMonthCompletedRate  >= 60 " class="circlemark circlemark-yellow">中</span>
                <span v-else class="circlemark circlemark-lightRed">差</span>
            </div>
        </router-link>
        <router-link tag="div" :to="routerPath('resultEvaluation')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">评价</p>
            <div class="analyItemCon">
                <p class="col-md-4">
                    <span class="pr8 cLightGray">好评</span>
                    <span>{{completmet.goodReviewCount}}</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">中评</span>
                    <span>{{completmet.duringReviewCount}}</span>
                </p>
                <p class="col-md-4">
                    <span class="pr8 cLightGray">差评</span>
                    <span>{{completmet.badReviewCount}}</span>
                </p>
            </div>
        </router-link>
    </div>
    <div class="pr10">
        <router-link tag="div" :to="routerPath('resultProcessing')" class="analyItem anItemBor" active-class="anItemBor-active">
            <p class="analyItemTit tx-center">处理</p>
            <div class="analyItemCon">

            </div>
        </router-link>
    </div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getCompletedVSecond } from '../Resources/Api'
export default {
    data () {
        return {
            parmasExample: {
                name: '',
                age: ''
            },
            completed: {}, // 人事
            completedMap: {},
            completmet: {},
            preLeMent: 0 // 完工率

        }
    },
    created () {
        this.getCompletedVSecond()
    },
    computed: {
        ...mapGetters(['userInfo', 'leftInfo'])
    },
    methods: {
        getCompletedVSecond () {
            getCompletedVSecond({
                regionID: this.leftInfo.u_diqu
            }).then(res => {
                if (res.data.StatusCode === 0) {
                    this.completmet = res.data.Body.completedMap
                }
            }).catch(err => {
                console.log(err)
            })
        },
        // 路由跳转路径拼接
        routerPath (path) {
            return this.$route.matched[1].path + '/' + path
        },
        // 直接进行路由跳转路径
        routerPush (path) {
            this.$router.push(this.$route.matched[1].path + '/' + path)
        }
    },
    watch: {
        leftInfo () {
            this.getCompletedVSecond()
            this.getCompleted()
        }
    }
}
</script>
